<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>收入支出每月汇总表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="收入、支出">
	<meta http-equiv="description" content="This is my page">

  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="getReportList.action" namespace="/inner/charge">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'收入支出管理'},{'name':'每月汇总表'}]"/>
    			<jsp:param name="width" value="40%"/>
    		</jsp:include>
    		
    		<s:hidden name="kindergartenId" id="kindergartenId"></s:hidden>
    		<s:hidden name="ievo.year" id="year"></s:hidden>
    		<s:hidden name="ievo.month" id="month"></s:hidden>
    		<table cellspacing="0" width="100%">
				<tr>
					<td align="left">
						<s:if test='existLock != true'>
							<input type="button" value="新增" class="btn" onclick="addIncomeExpense()"/>
						</s:if>
						<s:if test='existLock != true'>
							<input type="button" value="删除" class="btn" onclick="delIncomeExpense()"/>
						</s:if>
						<input type="button" value="ToExcel" class="btn" onclick="toExcel()"/>
					</td>
				</tr>
			</table>
    		
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr class="tableHead" align="center">
    				<td width="5%">
    					<input type="checkbox" onclick="cbCheck(this, 'ieIds')" />
    				</td>
    				<td width="5%">
    					序号
    				</td>
    				<td width="13%">
    					日期
    				</td>
    				<td width="25%">
    					备注
    				</td>
    				<td width="20%">
    					指标
    				</td>
    				<td width="16%">
    					其他收入
    				</td>
    				<td width="16%">
    					支出
    				</td>
    			</tr>
    			<s:iterator value="lp.list" status="s">
    				<tr align="center"
    					<s:if test="#s.index%2==0">class="tableRow2" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow2'"</s:if>
						<s:else>class="tableRow1" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow1'"</s:else>
    				>
    					<td>
    						<input name="ieIds" type="checkbox" value="<s:property value='id'/>" />
    					</td>
    					<td>
    						<s:property value="(pager.thisPage - 1) * pager.pageSize + #s.index + 1" />
    					</td>
    					<td>
    						<s:property value="chargeTime"/>
    					</td>
    					<td>
    						<s:property value="remark"/>
    					</td>
    					<td>
    						<s:if test='existLock != true'>
    						<a href="javascript:updateIncomeExpense('<s:property value="id"/>')">
    							<s:property value="indexName"/>
    						</a>
    						</s:if>
    						<s:else>
    							<s:property value="indexName"/>
    						</s:else>
    					</td>
    					<td>
    						<s:if test='amount != 0.00'>
    						<s:property value="amount"/>
    						</s:if>
    					</td>
    					<td>
    						<s:if test='amount2 != 0.00'>
    						<s:property value="amount2"/>
    						</s:if>
    					</td>
    				</tr>
    			</s:iterator>
    			<tr align="center" bgcolor="yellow">
    					<td colspan="5" align="left">
    						合计：
    					</td>
    					<td>
    						<s:property value="ievo.amountStart"/>
    					</td>
    					<td>
    						<s:property value="ievo.amountEnd"/>
    					</td>
    				</tr>
    			<jsp:include page="/common/pager/pager.jsp">
					<jsp:param name="formName" value="frm" />
					<jsp:param name="id" value="1" />
				</jsp:include>
    		</table>
    	</s:form>
    </center>
    
    <script type="text/javascript">
    
    function searchThis()
    {
    	$('#thisPage').val(1);
    	$('#frm').submit();
    }

    function toExcel()
    {
		var url = realPath + '/inner/charge/getIncomeExpenseReportExcel.action';
		document.forms['frm'].target = '_blank';
		document.forms['frm'].action = url;
		document.forms['frm'].submit();
		document.forms['frm'].action = realPath + '/inner/charge/getReportList.action';
		document.forms['frm'].target = '_self';
    }
    
    function addIncomeExpense()
    {
    	var year = $('#year');
    	var month = $('#month');
    	var kgId = getTopKg();
    	var url = realPath + '/inner/charge/toAddIncomeExpense.action?kindergartenId=' + kgId + '&ie.year=' + year.val() + '&ie.month=' + month.val();
    	openWin(url, 700, 400, 'yes', 'yes');
    }
    
    function updateIncomeExpense(id)
    {
    	var url = realPath + '/inner/charge/toUpdateIncomeExpense.action?ie.id=' + id;
    	openWin(url, 700, 400, 'yes', 'yes');
    }
    
    function delIncomeExpense()
    {
    	var url = 'inner/charge/delIncomeExpense.action';
    	showConfirm('确认删除？', function(v){
    		if(v == true)
    		{
    			ajaxAction(url, 'post', 'frm', false, function(){
   					searchThis();
    			});
    		}
    	});
    }
    
    </script>
  </body>
</html>
